'''
Author: xubing
Date: 2021-07-30 15:16:47
LastEditors: xubing
LastEditTime: 2021-07-30 15:16:48
FilePath: /my_gists/EDA/figure_plotter.py
'''
import numpy as np
import matplotlib.pyplot as plt


# class FigPlotter:
#     def __init__(self):
#         pass

#     def plot_bar(self, x, ys, save_path=None):
#         plt.bar(x, y)
#         for a, b in zip(x, y):
#             plt.text(a, b + 0.2, b, ha='center', va='center')
#         # plt.legend(loc='upper right')
#         # plt.xlabel(xlabel=xlabel)
#         # plt.ylabel(ylabel=ylabel)
#         # plt.title(title)
#         if save_path is not None:
#             plt.savefig(save_path)
#             plt.show()
#         else:
#             plt.show()

#     def plot_confusion_matrix():
#         pass

#     def plot_roc():
#         pass

#     def plot_box():
#         pass


if __name__ == '__main__':
    # fp = FigPlotter()
    # fp.plot_bar([1, 2, 3, 4, 5], [6, 7, 8, 9, 10])
    import matplotlib.pyplot as plt

    labels = ['G1', 'G2', 'G3', 'G4', 'G5']
    men_means = [20, 34, 30, 35, 27]
    women_means = [25, 32, 34, 20, 25]

    x = np.arange(len(labels))  # the label locations
    width = 0.35  # the width of the bars

    fig, ax = plt.subplots()
    rects1 = ax.bar(x - width/2, men_means, width, label='Men')
    rects2 = ax.bar(x + width/2, women_means, width, label='Women')

    # Add some text for labels, title and custom x-axis tick labels, etc.
    ax.set_ylabel('Scores')
    ax.set_title('Scores by group and gender')
    ax.set_xticks(x)
    ax.set_xticklabels(labels)
    ax.legend()

    ax.bar_label(rects1, padding=3)
    ax.bar_label(rects2, padding=3)

    fig.tight_layout()

    plt.show()
